window.onload = function () {
    getJson(api+"recommend/getNewest","getNewest");
    getJson(api+"recommend/getTotalClicks","getTotal");
    getJson(api+"recommend/getMonthClicks","getMonth");
    getJson(api+"recommend/getRandom","getRandom");
    getJson(api+"web/primaryClassification/1","menuOne");
    getJson(api+"web/primaryClassification/2","menuTwo");
    getJson(api+"web/primaryClassification/3","menuThree");
    getJson(api+"web/primaryClassification/4","menuFour");
    getJson(api+"web/primaryClassification/5","menuFive");
    getJson(api+"web/primaryClassification/6","menuSix");
    getJson(api+"web/primaryClassification/7","menuSeven");
};


function getJson(url,addr) {
    $.getJSON(url, function (rs) {
        var html = "";
        if (rs.code == 200){
            for (var i = 0; i < rs.data.length; i++) {
                html = html + ' <li>' +
                    '<a href="/Novel-Website/page/目录.html?id='+rs.data[i].id+'" title="'+ rs.data[i].bookName + rs.data[i].author+'">'
                    + rs.data[i].bookName + rs.data[i].author +
                    '</a>' +
                    '<spanclass = "updatetime">'+rs.data[i].createTime+'</span>' +
                    '</li>';
            }
        }
        document.getElementById(addr).innerHTML = html;
    })
}

